import 'package:flutter/material.dart';

import '../../tool/assets.dart';

class Label extends StatefulWidget {
  String text;
  double fontsize;
  Color textColor;
  Color borderColor;
  Color backgroudColor;
  double radius;
  double borderWidth;
  Widget? richText;
  Label(this.text,
      {this.fontsize = 14,
      this.textColor = Colors.black,
      this.borderColor = Colors.black,
      this.backgroudColor = Color_bg_view,
      this.radius = 4,
      this.borderWidth = 0.5,
      this.richText,
      super.key});

  @override
  State<Label> createState() => _LabelState();
}

class _LabelState extends State<Label> {
  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: widget.backgroudColor,
        borderRadius: BorderRadius.all(Radius.circular(widget.radius)),
        border:
            Border.all(color: widget.borderColor, width: widget.borderWidth),
        boxShadow: const [BoxShadow(color: Colors.black26, blurRadius: 8)],
      ),
      child: Center(
        child: widget.richText ??
            FittedBox(
              fit: BoxFit.contain,
              child: Text(
                widget.text,
                textAlign: TextAlign.center,
                style: TextStyle(
                    fontSize: widget.fontsize, color: widget.textColor),
              ),
            ),
      ),
    );
  }
}
